<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
<meta name="description" content="" />
<meta name="viewport" content="user-scalable=no">

<meta name="google-site-verification"
	content="BstJA3X9z6f9HcvoN9AZTwaKo_9Abj_j7dVBPfy640s" />
<meta name="baidu-site-verification" content="IYCrtVH0i1" />
<meta property="wb:webmaster" content="239d3d1dbdde1b2c" />
<link rel="icon" type="image/png"
	href="${pageContext.request.contextPath }/images/favicon.ico" />


<!-- Custom styles for this template -->

<!-- Bootstrap core CSS -->
<link href="${pageContext.request.contextPath}/css/bootstrap.min.css"
	rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/dashboard.css"
	rel="stylesheet">

<!-- Custom styles for this template -->


<script type="text/javascript">
			(function(document, screen) {
				if(screen.width < 760) {
					document.location.href = "/mobile/";
				}
			}(document, screen));
		</script>

<link rel="stylesheet"
	href="${pageContext.request.contextPath }/css/common.css?v=2015-5-20" />

<link rel="stylesheet"
	href="${pageContext.request.contextPath }/css/user_center.css" />

<title>订单管理</title>
</head>

<body class="day " ng-controller="bodyCtrl" day-or-night>
	<section class="common-back" id="wrapBackground">

		<header id="header">
			<div class="common-width clearfix">
				<h1 class="fl"></h1>

				 <ul class="member" login-box>
                            <li><a href="${pageContext.request.contextPath }/food/list" class="index">首页</a></li>
                            <li class="login-register"><a href="${pageContext.request.contextPath }/login_seller.jsp" referer-url  class="login"  rel="nofollow">登录</a><span class="cg">/</span><a href="register.html" referer-url  rel="nofollow" class="register">注册</a></li>
                          
                           
                        </ul>

			</div>
		</header>

		<section class="user-center-body ">
			<div class="user-center-main-box common-width clearfix">

				<article class="fl user-center-main">
					<header>挂单列表</header>


					<section class="user-center-body order" id="orderBody">

						<div class="order-list ">
							<div class="">

								<div class="table-responsive">
									<table class="table table-striped table-hover">
										<thead>
											<tr class="text-center">
												<th>订单编号</th>
												<th>桌号</th>
												<th>订单价格</th>
												<th>订单时间</th>
												<th>操作</th>
											</tr>
										</thead>
										<tbody>



											<c:forEach items="${requestScope.pData.data}" var="ord">

												<tr>
													<td>${ord.orderId}</td>
													<td>${ord.deskName}</td>
													<td>${ord.orderPrice}</td>
													<td>${ord.orderDate}</td>


													<td class="col-md-4"><button
															class="btn  del btn-primary yuedu" data-toggle="modal"
															data-target="#myModal">查看订单详情</button> <a
														href="/JIKE/js?orderId=${ord.orderId}&deskName=${ord.deskName}&orderPrice=${ord.orderPrice}"><button
																class="btn  btn-success">结算</button></a></td>
												</tr>

											</c:forEach>




										</tbody>
									</table>
								</div>

								<!-- layui分页开始 -->
								<div id="pageDiv" style="text-align: center"></div>
								<!-- layui分页结束 -->
							</div>
						</div>
					</section>

				</article>


			</div>
		</section>
	</section>

	<footer id="footer"> </footer>


	<script src="${pageContext.request.contextPath }/js/jquery-1.8.1.js"></script>
	<script
		src="${pageContext.request.contextPath }/js/jquery.uploadify.min.js"></script>

	<script type="text/javascript"
		src="${pageContext.request.contextPath }/js/angular.min.js"></script>
	<script src="${pageContext.request.contextPath }/js/common.js"></script>

	<script src="${pageContext.request.contextPath }/js/service.js"></script>
	<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
	<script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>








	<!-- Baidu Analytics -->
	<!-- layui的部分呢 -->
	<link rel="stylesheet"
		href="${pageContext.request.contextPath}/layui/css/layui.css"
		media="all">

	<script src="${pageContext.request.contextPath}/layui/layui.js"
		charset="utf-8"></script>
	<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
	<script>
layui.use(['laypage', 'layer'], function(){
  var laypage = layui.laypage
  ,layer = layui.layer;
  
//完整功能
  laypage.render({
    elem: 'pageDiv'
    ,count: ${pData.total} ,
    curr:${pData.page}
   ,limit:${pData.pageSize}
    ,layout: ['count', 'prev', 'page','limit','next', 'skip']
    ,jump: function(obj,first){
      console.log(obj);
      console.log(first);
    //首次不执行
      if(!first){
        //do something
    	  location.href="${pageContext.request.contextPath}/order/list?page="+obj.curr+"&pageSize="+obj.limit;
      }
    }
  });
 
});

</script>
	<script type="text/javascript">
			

			$(".yuedu").click(function(){
				//$(this)当按钮所在的文本行 parents("tr")当前行 find("td").eq(0)第一列
				//alert($(this).parents("tr").find("td").eq(0).text());
				 var orderId=$(this).parents("tr").find("td").eq(0).text();
				 $.ajax({
						type:"get",
						url:"getordetail/"+orderId,
						dataType:"json",
						success:function(result){
						  // console.log(result);
							$("#tabledetail  tr:not(:first)").empty("");
						   $.each(result, function(i,d) {
							
							   $("#detail").append("<tr><td>"+d.orderDetailId+"</td><td>"+d.foodName+"</td><td>￥"+d.foodPrice+"</td><td>"+d.buyNumber+"</td></tr>");
							   
							});
						}
					});
				 
				
			});
		</script>
	<!-- Modal -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title" id="myModalLabel">订单详情</h4>
				</div>
				<div class="modal-body">

					<section class="user-center-body order" id="orderBody">

						<div class="order-list ">
							<div class="">

								<div class="table-responsive">
									<table class="table table-striped table-hover" id="tabledetail">
										<thead>
											<tr class="text-center">
												<th>编号</th>
												<th>菜名</th>
												<th>单价</th>
												<th>购买数量</th>

											</tr>
										</thead>
										<tbody id="detail">


										</tbody>
									</table>
								</div>


							</div>
						</div>
					</section>

				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>

				</div>
			</div>
		</div>
	</div>

</body>

</html>